package com.study.model.pojo;

import java.io.Serializable;
import javax.persistence.*;
import java.util.List;


/**
 * The persistent class for the addresdetail database table.
 * 
 */
@Entity
@NamedQuery(name="Addresdetail.findAll", query="SELECT a FROM Addresdetail a")
public class Addresdetail implements Serializable {
	private static final long serialVersionUID = 1L;

	@Id
	@Column(name = "ad_id", nullable = false)
	private int adId;

	@Column(name="ad_address")
	private String adAddress;

	@Column(name="ad_man")
	private String adMan;

	@Column(name="ad_phone")
	private String adPhone;

	//bi-directional many-to-one association to Dictionary
	@ManyToOne
	@JoinColumn(name="ad_type")
	private Dictionary dictionary;

	//bi-directional many-to-one association to Customer
	@OneToMany(mappedBy="addresdetail")
	private List<Customer> customers;

	
	//bi-directional many-to-one association to Orderform
	@OneToMany(mappedBy="addresdetail")
	private List<Orderform> orderforms;

	public Addresdetail() {
	}
	
	public int getAdId() {
		return this.adId;
	}

	public void setAdId(int adId) {
		this.adId = adId;
	}

	public String getAdAddress() {
		return this.adAddress;
	}

	public void setAdAddress(String adAddress) {
		this.adAddress = adAddress;
	}

	public String getAdMan() {
		return this.adMan;
	}

	public void setAdMan(String adMan) {
		this.adMan = adMan;
	}

	public String getAdPhone() {
		return this.adPhone;
	}

	public void setAdPhone(String adPhone) {
		this.adPhone = adPhone;
	}

	public Dictionary getDictionary() {
		return this.dictionary;
	}

	public void setDictionary(Dictionary dictionary) {
		this.dictionary = dictionary;
	}

	public List<Customer> getCustomers() {
		return this.customers;
	}

	public void setCustomers(List<Customer> customers) {
		this.customers = customers;
	}

	public Customer addCustomer(Customer customer) {
		getCustomers().add(customer);
		customer.setAddresdetail(this);

		return customer;
	}

	public Customer removeCustomer(Customer customer) {
		getCustomers().remove(customer);
		customer.setAddresdetail(null);

		return customer;
	}

	public List<Orderform> getOrderforms() {
		return this.orderforms;
	}

	public void setOrderforms(List<Orderform> orderforms) {
		this.orderforms = orderforms;
	}

	public Orderform addOrderform(Orderform orderform) {
		getOrderforms().add(orderform);
		orderform.setAddresdetail(this);

		return orderform;
	}

	public Orderform removeOrderform(Orderform orderform) {
		getOrderforms().remove(orderform);
		orderform.setAddresdetail(null);

		return orderform;
	}

	@Override
	public String toString() {
		return "Addresdetail [adId=" + adId + ", adAddress=" + adAddress + ", adMan=" + adMan + ", adPhone=" + adPhone
				;
	}
		
}